package com.example.sys.org.controller;

import com.example.core.controller.BaseController;
import com.example.core.service.XMLDataBean;
import com.example.sys.org.form.SysOrgElementForm;
import com.example.sys.org.model.SysOrgElement;
import com.example.sys.org.service.SysOrgElementService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

@Controller
@RequestMapping("sysOrgElement")
public class SysOrgElementController extends BaseController<SysOrgElementService, SysOrgElementForm> {

    @ResponseBody
    @PostMapping("getTree")
    public List<SysOrgElement> getTree(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
        SysOrgElementService sysOrgElementService = this.getService();
        return ((XMLDataBean) sysOrgElementService).getData(null);
    }
}
